package com.tuxianchao.demo.springbootdruiddatasourcemonitor.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;

/**
 * @author
 * @create 2018-04-15 21:35
 **/

@RestController
public class TestController {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @GetMapping("test01")
    public Object test01() throws SQLException {
        jdbcTemplate.execute("SELECT * FROM tbl_user");
        return "o98k";
    }

    @GetMapping("test02")
    public Object test02() throws SQLException {
        jdbcTemplate.execute("SELECT COUNT(*) FROM tbl_user");
        return "o98k";
    }
}
